package cn.com.thinker.security.sdk.sso.handler.impl;

import cn.com.thinker.security.sdk.sso.handler.ClientLoginHandler;
import cn.com.thinker.security.sdk.sso.model.EncryCredentialInfo;

import java.util.logging.Logger;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * 默认的登录认证实现。
 * @author crazyhc
 *
 */
public class DefaultClientLoginHandlerImpl implements ClientLoginHandler {
	
	private static Logger logger = Logger.getLogger(DefaultClientLoginHandlerImpl.class.getName());

	public static final String USER_KEY = "USER_KEY_SESSON";
	
	@Override
	public void loginClient(EncryCredentialInfo encryCredentialInfo, HttpServletRequest request, HttpServletResponse response) {
		request.getSession().setAttribute(USER_KEY, encryCredentialInfo);
		logger.info("the user id is "+encryCredentialInfo.getUserId() +" has logined in the app");
	}

}
